# Maintainer: Chloe Kudryavtsev <toast@toast.cafe>

# RESTRICTED: Do not upgrade to any version licensed under AGPL.  No evidence
# has been found supporting the existence of a CLA or relicensing campaign,
# so we cannot confirm the legal validity of the license change.  Accordingly,
# any commit upgrading the version to an AGPL-licensed version WILL be reverted.

pkgname=minio-client
_pkgname=mc
_pkgver='RELEASE.2020-12-18T10-53-53Z'
pkgver=${_pkgver#*.}
pkgver=${pkgver%T*}
pkgver=0.${pkgver//-}
pkgrel=6
pkgdesc="The MinIO Client"
url="https://minio.io/"
license="Apache-2.0"
arch="all"
makedepends="go"
source="$_pkgname-$pkgver.tar.gz::https://github.com/minio/$_pkgname/archive/$_pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$_pkgver"
options="net"

export GOPATH="$srcdir"
export CGO_ENABLED=0

build() {
	local _ldflags=$(go run buildscripts/gen-ldflags.go 2> /dev/null)
	go build -tags kqueue --ldflags "$_ldflags" -o bin/mc
}

check() {
	# mc/cmd is disabled, seems to be outdated and fails on all my systems
	go test -tags kqueue $(go list ./... | grep -v \
		-e cmd \
		)
}

package() {
	install -Dm755 "$builddir"/bin/mc \
		"$pkgdir"/usr/bin/mcli
}

cleanup_srcdir() {
	go clean -modcache
	default_cleanup_srcdir
}
sha512sums="7559df5c607cbb0e3a5bbeb83df97c2162ccce98ea3891243f8eb8ad3c1c5b35630baed3ec2659ddf2e4672b272b605f1546f07e6cde6c5c104623b7b6df7c6e  mc-0.20201218.tar.gz"
